<template>
  <div>
    <!-- 本周牛人 -->
<!--    <div class="bbs_left_box">
      <h3 class="com_title">
        <span>本周牛人</span>
        <a target="_blank" class="bbs_more">更多</a>
      </h3>
      <div class="bbs_cow_c clearfix">
        <dl class="cow_c_list">
          <dt>
            <a style="display: inline-block;position: relative;" target="_blank">
              <img src="../../assets/images/profile.jpg" alt="pengdali" class="avatar">
            </a>
          </dt>
          <dd>
            <h4>
              <a class="user_name cow_nick_name" title="黄玉东">黄玉东</a>
            </h4>
            <div class="grade"></div>
            <a class="att genius_att att_active">关注</a>
          </dd>
        </dl>
      </div>
    </div>-->

    <div class="bbs_left_box">
      <h3 class="com_title">
        <span>热帖</span>
<!--        <a href="/tech_hot_topics" target="_blank" class="bbs_more">更多</a>-->
      </h3>
      <div class="hotTopic_t">
        <span class="topic0">标题</span>
        <span class="topic1">发贴人</span>
        <span class="topic2">回复数</span>
        <span class="topic3">人气</span>
      </div>
      <ul class="hotTopic_c">
        <li v-for="(item,index) in forumList" :key="index">
          <label class="hotTop_t">
<!--            <em class="classify_dot">・</em>-->
            <a @click="btnClick(item)" class="topic_title" :title="item.forumTitle">{{ item.forumTitle }}</a>
          </label>
          <router-link class="questioner" :to="'/personal?id='+item.userId">{{ item.user.nickName }}</router-link>
          <span class="reply_num">{{ item.reply }}</span>
          <span class="view">{{ item.click }}</span>
        </li>
      </ul>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </div>
</template>

<script>
import { listForum,updateClickNumber } from '@/api/forum'
export default {
  name: 'home',
  data(){
    return{
      // 论坛表格数据
      forumList: [],
      forumListWeek: [],
      btnFlag: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        forumTitle: undefined,
        userId: undefined,
        accept: undefined,
        report: '0',
        status: '1',
        orderByColumn: "click",
        isAsc:'desc'
      },
      total: 0
    }
  },
  created() {
    this.getList()
  },
  methods: {
    /** 查询论坛列表 */
    getList() {
      listForum(this.queryParams).then(response => {
        this.forumList = response.rows
        this.total = response.total
      })
      /*let queryParamsWeek={
        pageNum: 1,
        pageSize: 5,
        report: '0',
        status: '1'
      }
      listForum(this.addDateWeekRange(queryParamsWeek)).then(response => {
        this.forumListWeek = response.rows
      })*/
    },
    btnClick(data){
      updateClickNumber(data.forumId)
      this.$router.push({
        path: '/forum/edit',
        query: {
          id: data.forumId
        }
      })
    }

  },
}
</script>

<style scoped>

</style>
